package com.goulin.sprmvc.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.goulin.sprmvc.domain.DemoObj;

@RestController//注意此标签下面的用法
@RequestMapping("/rest")
public class DemoRestController {
	@RequestMapping(value="getjson",produces={"application/json;chareset=UTF-8"})
	public DemoObj getJson(DemoObj obj){
		return new DemoObj(obj.getId(),obj.getName()+",hello");
	}
	
	@RequestMapping(value="getxml",produces={"application/xml;chareset=UTF-8"})
	public DemoObj getXml(DemoObj obj){
		return new DemoObj(obj.getId(),obj.getName()+",hello");
	}
}
